<?php

include_once('logic/view/View.php');

class ManageView extends View
{
	private	$_entries;
	private $_tags;

	// admin
	function __construct()
	{
		parent::__construct("ADMINISTRATOR");
		$this->_xsl_template = 'template/manage_template.xsl';

		// photos element
		$this->_entries = $this->_root->appendChild($this->_xml_doc->createElement('entries'));
		// tags element
		$this->_tags = $this->_root->appendChild($this->_xml_doc->createElement('tags'));

		// <archives>
		// ...
		// </archives>

		// <photos>
		// ...
		// </photos>

		// <tags>
		// ...
		// </tags>
	}

	function addEntry($id, $date)
	{
		// <entry>
		//   <id>$id</id>
		//   <date>$date</date>
		// </entry>

		$entry = $this->_xml_doc->createElement('entry');
		$this->_entries->appendChild($entry);

		$id_node = $entry->appendChild($this->_xml_doc->createElement('id'));
		$id_node->appendChild($this->_xml_doc->createTextNode($id));

		$day_node = $entry->appendChild($this->_xml_doc->createElement('date'));
		$day_node->appendChild($this->_xml_doc->createTextNode($date));
	}

	function addTag($tagText)
	{
		// <photo>
		//   <text>$tagText</text>
		// </photo>
		$tag = $this->_xml_doc->createElement('tag');
		$this->_tags->appendChild($tag);

		$text_node = $tag->appendChild($this->_xml_doc->createElement('text'));
		$text_node->appendChild($this->_xml_doc->createTextNode($tagText));
	}
}

?>
